{load_comments}
{config_load file="main.txt" section=comments}
<script language="JavaScript" type="text/javascript">
    var thisPage = '{$INA.this}';
    
    {if $smarty.get.rand}
        Fat.fade_element('comment_{$smarty.get.rand}',10,3000,"#ffffaa");
    {/if}
</script>
<script language="JavaScript" type="text/javascript" src="{$INA.templates}jscripts/comments.js"></script>

{if $above}
<!-- comments start -->
<div id="comments">
    {foreach from=$comments.data item=comment}
        {math equation="(x-1)*25" x=$comment.level assign=offset}
        <!-- cid: {$comment.comment_id} -->
        <div class="comment" style="margin-left: {$offset}px;">        
            <div class="comment_poster" id="comment_{$comment.comment_id}">
                {if $comment.sender_url}
                    <a href="{$comment.sender_url}" target="_blank">{$comment.sender_name}</a> 
                {else}
                    <strong>{$comment.sender_name}</strong>
                {/if}
                
                <span class="comment_date">&nbsp;&nbsp;{$comment.created|date_format:'%d %b %Y'}</span>
                <a name="c{$comment.comment_id}"> </a>
            </div>
            <div class="comment_content">
                {$comment.comment}
            </div>
            
            <div class="comment_links">
                [&nbsp;<a href="#c{$comment.comment_id}">{#permalink#}</a>&nbsp;] {if $comment.level < $tree_depth}[&nbsp;<a href="javascript:quickreply({$comment.comment_id});">{#reply#}</a>&nbsp;]{/if}
            </div>
            
            <div id="{$comment.comment_id}"></div>
        </div>
        <!-- /cid: {$comment.comment_id} -->
    {/foreach}
</div>
<!-- comments end -->
{/if}

<!-- comment add form start -->
<div id="comment_form"> 
    {if (($sentinel and $value) or (!$sentinel and !$value))}
    <dl>
        {if !$name}
            <dt class="inline"><label for="author"><strong>{#name#}</strong></label></dt>
            <dd class="inline"><input id="comment_name" name="comment[name]" size="30" tabindex="1" type="text" value="{$smarty.cookies.cName}" /></dd>
        {else}
            <input type="hidden" id="comment_name" name="comment[name]" value="{$name}" />
        {/if}
    
        
        {if !$mail}
            <dt class="inline"><label for="email">{#mail#}</label></dt>
            <dd class="inline"><input id="comment_email" name="comment[email]" size="30" tabindex="2" type="text" value="{$smarty.cookies.cMail}" /></dd>
        {else}
            <input id="comment_email" name="comment[email]" type="hidden" value="{$mail}" />
        {/if}
    
        {if !$nourl and !url}
            <dt class="inline"><label for="url">{#url#}</label></dt>
            <dd class="inline"><input id="comment_url" name="comment[url]" size="30" tabindex="3" type="text" value="{$smarty.cookies.cURL}" /></dd>
        {else}
            {if $url}
                <input id="comment_url" name="comment[url]" type="hidden" value="{$url}" />
            {/if}
        {/if}
        
        <dt class="textarealabel"><label for="text"><strong>{#comments#}</strong></label> <span>[ {#cHelp#} ]</span></dt>
        <dd><textarea cols="24" id="comment_comment" name="comment[comment]" rows="10" tabindex="5"></textarea><p id="caveat" style="font-size: 10px;"><strong>NOTE:</strong> {#cHelp2#}</p></dd>
        
        <p class="submit">
            <input name="commit" style="font-weight: bold" tabindex="6" type="button" id="addComment" value="{#pComment#}" onclick="postComment(this,{$comments.pid},{$comments.ptype});" onkeydown="postComment(this,{$comments.pid},{$comments.ptype});" />
        </p>
    </dl>
    
    <div id="quickAddComment" style="display: none;">
        <div class="qAddComment">
            <table cellpadding="2" cellspacing="0" width="100%">
                <tr>
                    <td width="50" align="right"><strong>{#name#}</strong></td>
                    <td><input id="q_comment_name" name="comment[name]" size="30" tabindex="7" type="text" value="{$smarty.cookies.cName}" /></td>
                </tr>
                <tr>
                    <td align="right">{#mail#}</td>
                    <td><input id="q_comment_email" name="comment[email]" size="30" tabindex="8" type="text" value="{$smarty.cookies.cMail}" /></td>
                </tr>
                {if !$nourl}
                <tr>
                    <td align="right">{#url#}</td>
                    <td><input id="q_comment_url" name="comment[url]" size="30" tabindex="9" type="text" value="{$smarty.cookies.cURL}" /></td>
                </tr>
                {/if}
                <tr>
                    <td colspan="2">
                        <label for="text"><strong>{#comments#}</strong></label> <span class="commentNote">[ {#cHelp#} ]</span><br />
                        <textarea cols="24" id="q_comment_comment" name="comment[comment]" rows="10" tabindex="10" style="width: 98%;"></textarea>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <input name="q_commit" style="font-weight: bold" tabindex="11" type="button" id="addReply" value="{#pReply#}" onkeydown="postComment(this,{$comments.pid},{$comments.ptype},true);" onclick="postComment(this,{$comments.pid},{$comments.ptype},true);" />
                        <input name="cancel" type="button" tabindex="12" value="{#cancel#}" onclick="hide('quickAddComment');" onkeydown="hide('quickAddComment');" />
                    </td>
                </tr>
            </table>
            <input type='hidden' name="replyto" value="" id="quickReplyID" />
        </div>
    </div>
    {/if}
</div>
<!-- comment add form end -->

{if !$above}
<!-- comments start -->
<div id="comments">
    {foreach from=$comments.data item=comment}
        {math equation="(x-1)*25" x=$comment.level assign=offset}
        <!-- cid: {$comment.comment_id} -->
        <div class="comment" style="margin-left: {$offset}px;">        
            <div class="comment_poster" id="comment_{$comment.comment_id}">
                {if $comment.sender_url}
                    <a href="{$comment.sender_url}" target="_blank">{$comment.sender_name}</a> 
                {else}
                    <strong>{$comment.sender_name}</strong>
                {/if}
                
                <span class="comment_date">&nbsp;&nbsp;{$comment.created|date_format:'%d %b %Y'}</span>
                <a name="c{$comment.comment_id}"> </a>
            </div>
            <div class="comment_content">
                {$comment.comment}
            </div>
            
            <div class="comment_links">
                [&nbsp;<a href="#c{$comment.comment_id}">{#permalink#}</a>&nbsp;] {if $comment.level < $tree_depth}[&nbsp;<a href="javascript:quickreply({$comment.comment_id});">{#reply#}</a>&nbsp;]{/if}
            </div>
            
            <div id="{$comment.comment_id}"></div>
        </div>
        <!-- /cid: {$comment.comment_id} -->
    {/foreach}
</div>
<!-- comments end -->
{/if}
